package com.cloud.force.api.command;

import org.springframework.context.ApplicationContext;

import com.cloud.force.api.handler.Handler;
import com.cloud.force.api.handler.HandlerChain;
import com.cloud.force.api.handler.Request;
import com.cloud.force.api.handler.Response;

/**
 * 操作菜单抽象接口
 * 
 * @author minglong.tao
 *
 */
public abstract class Command implements Handler {
	
	/**
	 * 指令执行器顶层接口
	 * @param request 请求参数
	 * @param resp 响应参数
	 */
	public abstract void execute(Request request, Response resp, ApplicationContext context);
	
	
	//指令专注于处理业务逻辑
	public void handler(Request request, Response resp, HandlerChain chain){
		this.execute(request, resp, chain.getApplicationContext());
		chain.doHandler(request, resp);
	}
	

}
